/*
 * util.hpp
 *
 *  Created on: Nov 7, 2009
 *      Author: anguelos
 */

#ifndef UTIL_HPP_
#define UTIL_HPP_

#include <ctime>
#include <string>
#include <sstream>
#include <map>
#include <vector>

namespace quadil{
namespace util{
	class Timer{
		clock_t t;
	public:
		Timer(){
			t=clock();
		}
		void tic(){
			t=clock();
		}
		int getMiliseconds(){
			return (clock()-t)/(0.001*CLOCKS_PER_SEC);
		}
		int getMicroseconds(){
			return (clock()-t)/(0.000001*CLOCKS_PER_SEC);
		}
		double getSeconds(){
			return (clock()-t)/(1.0*CLOCKS_PER_SEC);
		}
		double getMinutes(){
			return (clock()-t)/(60.0*CLOCKS_PER_SEC);
		}
		double getHours(){
			return (clock()-t)/(3600.0*CLOCKS_PER_SEC);
		}
	};
	inline Image<t_label> loadFromRawFile(std::string fname){

	}
	inline void saveToRawFile(std::string fname,Image<t_label> &out){

	}

	class BoundToArgument{
		const static int string_argument_size;
		static std::map<std::string,BoundToArgument&> allArguments;
		union{
			bool* boolval;
			double* doubleval;
			int* intval;
		};
		union {
			bool defaultBool;
			double defaultDouble;
			int defaultInt;
		};
		std::string argname;
		std::string description;
		bool mandatory;
	public:
		BoundToArgument(double& v,std::string name,double def,std::string description=""){
			this->mandatory=false;
			argname=name;
			this->description=description;
			defaultDouble=def;
		}
	};
}
}

#endif /* UTIL_HPP_ */
